@extends('admin.layout.main')
@section('content')
    <link rel="stylesheet" href="{{asset('admin/css/chosen.min.css')}}" />

    <div class="main-content-inner">
        <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="/admin/index">首页</a>
                </li>

                <li>
                    <a href="/admin/admin">管理员管理</a>
                </li>
                <li class="active">编辑管理员信息</li>
            </ul><!-- /.breadcrumb -->

            <div class="nav-search" id="nav-search">
                <form class="form-search">
								<span class="input-icon">
									<input type="text" placeholder="Search ..." class="nav-search-input"
                                           id="nav-search-input" autocomplete="off"/>
									<i class="ace-icon fa fa-search nav-search-icon"></i>
								</span>
                </form>
            </div><!-- /.nav-search -->
        </div>

        <div class="page-content">
            {{--<div class="page-header">--}}
                {{--<h1>--}}
                    {{--Form Elements--}}
                    {{--<small>--}}
                        {{--<i class="ace-icon fa fa-angle-double-right"></i>--}}
                        {{--Common form elements and layouts--}}
                    {{--</small>--}}
                {{--</h1>--}}
            {{--</div><!-- /.page-header -->--}}

            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->
                    <form class="form-horizontal" role="form" name="linkform" method="post" action="/admin/admin/{{$data->id}}">
                       {{csrf_field()}}
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-1">管理员名称 </label>

                            <div class="col-sm-9">
                                <input type="text" name="username" readonly value="{{$data->username}}" id="form-field-1" placeholder="填写管理员名"
                                       class="col-xs-10 col-sm-5"/>
                                <input type="hidden" name="id" value="{{$data->id}}">
                                <input type="hidden" name="_method" value="PUT">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 管理员密码 </label>

                            <div class="col-sm-9">
                                <input type="text" name="old_password" id="form-field-1" placeholder="填写旧的管理密码"
                                       class="col-xs-10 col-sm-5"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-1">修改管理员密码 </label>

                            <div class="col-sm-9">
                                <input style="display:none"><!-- for disable autocomplete on chrome -->
                                <input type="text" name="password" autocomplete="off"onfocus="this.type='password'" id="form-field-2" placeholder="填写新的管理员密码"
                                       class="col-xs-10 col-sm-5"/>
                                <span class="help-inline col-xs-12 col-sm-7">
                                    <span class="middle">密码在6-25位之间</span>
                                </span>
                            </div>
                        </div>

                        <div class="space-4"></div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-select-1"> 角色 </label>

                            <div class="col-sm-9">
                                {{--<select class="col-xs-10 col-sm-5" id="form-field-select-1" name="name">--}}
                                <select  name="role[]" multiple class="chosen-select form-control tag-input-style" id="form-field-select-4" data-placeholder="选择角色">
                                    <option value="">请选择角色</option>
                                    @foreach($list as $item)
                                        <option @if(in_array($item['id'],$role_ids)) selected @endif value="{{$item['id']}}">{{$item['name']}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="space-4"></div>

                        <div class="clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                <button id="submitBtn" class="btn btn-info" type="submit">
                                    <i class="ace-icon fa fa-check bigger-110"></i>
                                    提交
                                </button>

                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="reset">
                                    <i class="ace-icon fa fa-undo bigger-110"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>
    <script src="{{asset('admin/js/jquery-ui.custom.min.js')}}"></script>
    <script src="{{asset('admin/js/jquery.ui.touch-punch.min.js')}}"></script>
    <script src="{{asset('admin/js/chosen.jquery.min.js')}}"></script>
    <script>
        jQuery(function($) {

            $('.chosen-select').chosen({allow_single_deselect:true});
            //resize the chosen on window resize


            $(window)
                .off('resize.chosen')
                .on('resize.chosen', function() {
                    $('.chosen-select').each(function() {
                        var $this = $(this);
                        $this.next().css({'width': $this.parent().width()});
                    })
                }).trigger('resize.chosen');
            //resize chosen on sidebar collapse/expand
            $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
                if(event_name != 'sidebar_collapsed') return;
                $('.chosen-select').each(function() {
                    var $this = $(this);
                    $this.next().css({'width': $this.parent().width()});
                })
            });



        });
    </script>
@endsection